// pages/shareAward/index.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        firstTitles: ['奖励金额', '销售金额', '粉丝数量'],
        secondTitles: ['全部', '未结算', '已结算'],
        salesList: [[], [], []],
        firstCurIndex: 0,
        secondCurIndex: 0,
        user: wx.getStorageSync('user')
    },
    onLoad() {
        console.log(23);
        wx.$ajax.getShareList({
            start: 1,
            size: 1000
        })
            .then(({data: {data, msg, status}, header, statusCode, errMsg}) => {
                if (status === '0') {
                    let {salesList} = this.data;
                    salesList[0] = data.list || [];
                    salesList[1] = salesList[0].filter(item => item.settlementStatus === '0' || item.settlementStatus === '')
                    salesList[2] = salesList[0].filter(item => item.settlementStatus === '1');
                    this.setData({
                        salesList
                    })

                } else {
                    console.log('请求失败');
                }
            })
    },
    // 第二个页面title改变
    selectTitleIndex(e) {
        this.setData({
            firstCurIndex: e.currentTarget.dataset.index
        })
    },
    // 第二个页面轮播改变
    secondIndexChange(e) {
        this.setData({
            secondCurIndex: e.currentTarget.dataset.index
        })
    },
    // 轮播改变
    swiperChange(e) {
        this.setData({
            firstCurIndex: e.detail.current
        })
    },
    // 第二个轮播改变
    secondSwiperChange(e) {
        this.setData({
            secondCurIndex: e.detail.current
        })
    }
})